<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>微信登录</title>
    <style>
        /* 模态框的样式 */
        .modal {
            display: none;
            position: fixed;
            z-index: 1;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgba(0, 0, 0, 0.4);
        }

        /* 模态框内容的样式 */
        .modal-content {
            background-color: #fff;
            margin: 15% auto;
            padding: 20px;
            border: 1px solid #888;
            width: 80%;
            max-width: 400px;
            text-align: center;
            box-sizing: border-box;
        }

        /* 关闭按钮的样式 */
        .close {
            color: #aaa;
            float: right;
            font-size: 28px;
            font-weight: bold;
        }

        .close:hover,
        .close:focus {
            color: black;
            text-decoration: none;
            cursor: pointer;
        }

        /* 二维码图片的样式 */
        .qr-code {
            width: 100%;
            max-width: 300px; /* 限制二维码的最大宽度 */
            height: auto;
            margin-top: 20px;
        }
    </style>
</head>
<body>
<img src="./imgs/wx.png" alt="微信登录" onclick="showQRCodeModal()" style="cursor: pointer;">

<!-- 二维码模态框 -->
<div id="qrCodeModal" class="modal">
    <div class="modal-content">
        <span class="close" onclick="closeQRCodeModal()">&times;</span>
        <p>请使用微信扫描以下二维码进行登录</p>
        <img src="../../../../vue-project/src/assets/loginCode.jpg" alt="微信登录二维码" class="qr-code">
    </div>
</div>

<script>
    // 显示二维码模态框
    function showQRCodeModal() {
        document.getElementById('qrCodeModal').style.display = 'block';
    }

    // 关闭二维码模态框
    function closeQRCodeModal() {
        document.getElementById('qrCodeModal').style.display = 'none';
    }

    // 点击窗口外部关闭模态框
    window.onclick = function(event) {
        const modal = document.getElementById('qrCodeModal');
        if (event.target === modal) {
            closeQRCodeModal();
        }
    }
</script>
</body>
</html>
